import Mock from './mock.angular';

Mock.mock('/api/v1/patrol/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        'checkOrgType|1': [1, 2, 3],
        patrolUserName: '@name',
        checkClassifyName: '@name',
        'checkResult|1': [1, 2, 3],
        rectifyDate: '@date',
        'recordStatus|1': [1, 2, 3],
        createdTime: '@date',
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/patrol/get', 'get', {
  success: true,
  message: '',
  code: 200,
  data: {
    id: '@id',
    orgId: '@id',
    checkNo: '@id',
    siteDescription: '@cname',
    checkClassifyId: '@id',
    checkItemName: '@cname',
    checkOrgType: '@cname',
    'isSync|1': [1, 2],
    rectifyDate: '@date',
    creatorName: '@cname',
    createdTime: '@date',
    'recordStatus|1': [1, 2, 3],
    'attentionState|1': [1, 2],
    files: [
      {
        id: '@id',
        fileName: '@cname',
        recordNo: '@id',
      },
    ],
    checkRectifyBean: {
      id: '@id',
      rectifyUserId: '@id',
      rectifyUserName: '@cname',
      rectifyTime: '@date',
      'rectifySituation|1': [1, 2, 3],
      reasonAnalysisCodes: [],
      auditUserName: '@cname',
      'auditResult|1': [1, 2],
      auditOpinion: '@cname',
      auditTime: '@date',
      files: [
        {
          id: '@id',
          fileName: '@cname',
          recordNo: '@id',
        },
      ],
    },
  },
});

Mock.mock('/api/v1/identity/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        fullName: '@cname',
        idNo: '@id',
        postName: '@word',
        rfidNo: '@word',
        collectTime: '@date',
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/identity/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staff/add', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staffInOut/out/add', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staffInOut/in/add', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staff/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/staff/update', 'post', {
  success: true,
  message: '',
  code: 200,
});


Mock.mock('/api/v1/staff/get', 'get', {
  success: true,
  message: '',
  code: 200,
  data: {
    personCollectBean: {
      id: '@id',
      orgId: '@id',
      fullName: '@cname',
      idNo: '@id',
      rfidNo: '@id',
      collectTime: '@date',
      idCardBean: {
        id: '@id',
        name: '@cname',
        'sex|1': [1, 2],
        'nation|1': ['汉族', '傣族'],
        birthday: '@date',
        address: '@province@city@zip',
        issueUnit: '@province@city()公安局',
        validPeriod: '1986-2016',
        photoId: '@id',
      },
    },
    orgPersonBean: {
      idNo: '@id',
      cellphone: '@id',
      orgName: '@word',
      fullName: '@cname',
      code: '@id',
      'type|1': [1, 2, 3],
      'degree|1': ['初中', '高中', '大学'],
      nativePlace: '@word',
      inTime: '@date',
      outTime: '@date',
      postCode: '@id',
      postName: '@word',
      remark: '@word',
      inOutStatus: 1,
      'departmentName|1': ['bumen1', 'bumen2'],
    },
    'certificateList|2-5': [
      {
        id: '@id',
        type: '@word',
        code: '@word',
        issueUnit: '@word',
        issueDate: '@date',
        validPeriod: '2015-2016',
      },
    ],
    'orgPersonFileList|2-5': [
      {
        'type|1': [1, 2],
        fileId: '@id',
        fileBean: {
          id: '@id',
          fileName: '@word',
        },
      },
    ],
  },
});

Mock.mock('/api/v1/staff/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        fullName: '@cname',
        idNo: '@id',
        code: '@id',
        postName: '@word',
        'type|1': [1, 2, 3],
        'inOutStatus|1': [1, 2],
        inTime: '@date',
        departmentName: '@word',
      },
    ],
  };
  return Mock.mock(respData);
}));
